﻿using System;
using System.Collections.Generic;
using System.Linq;

public class PrintDivBy7and3
{
    //Write a program that prints from given 
    //array of integers all numbers that are 
    //divisible by 7 and 3. Use the built-in 
    //extension methods and lambda expressions. 
    //Rewrite the same with LINQ.

    static void Main()
    {
        List<int> myArr = new List<int>();
        for (int i = 1; i < 86; i++)
        {
            myArr.Add(i);
        }

        var numbers = myArr.FindAll(x => x % 7 == 0 && x % 3 == 0);
        foreach (var item in numbers)
        {
            Console.Write("{0} ", item);
        }
        Console.WriteLine();

        var numbs =
            from x in myArr
            where x % 7 == 0 && x % 3 == 0
            select x;
        foreach (var item in numbs)
        {
            Console.Write("{0} ", item);
        }
        Console.WriteLine();
    }
}